import api from "@/api";
import { defineStore } from "pinia";
import { stringify, parse } from "zipson";

export const useAppStore = defineStore("appStore", {
  state: () => {
    return {
      isFirst: false, // 是否是第一次进入
      isAgree: false, //是否同意隐私协议
    };
  },
  getters: {},
  actions: {
    //同意隐私协议
    agreePrivacy() {
      this.isAgree = true;
    },
  },
  persist: {
    serializer: {
      deserialize: parse,
      serialize: stringify,
    },
    afterRestore: (ctx) => {
      console.log(`刚刚恢复完 '${ctx.store.$id}'`);
      console.log(ctx);
    },
  },
});
